package com.sz.biz.logistics.ord.service;

import com.sz.biz.logistics.ord.dto.*;
import com.sz.biz.logistics.ord.entity.OrdOrderBatch;
import com.sz.biz.logistics.ord.entity.OrdOrderFile;
import com.sz.biz.logistics.ord.entity.OrderStatus;
import com.sz.common.base.dto.QResultDto;
import com.sz.common.base.dto.QueryParams;
import io.swagger.models.auth.In;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Map;

/**
 * Package: com.sz.biz.logistics.ord.service<br>
 * Function: 订单批次service
 * Author: yanhong.xiao.<br>
 * Date: 2017-11-22 18:37:00.
 */
public interface OrdOrderBatchService {
    /**
     * 解析excel的数据，得到OrdOrderBatch
     *
     * @param inputStream
     * @return
     * @throws IOException
     * @throws InvalidFormatException
     */
    OrdReadResultDto readCusExcelFromStream(InputStream inputStream) throws IOException, InvalidFormatException;

    List<String> queryBatchNumbers(int accountId, int type);

    void deleteByBatchNumber(String batchNumber);

    void deleteByBatchNumbers(List<String> batchNumbers);

    /**
     * 校验 批量导入订单的数据
     *
     * @param lstExcelOrderData
     * @return
     */
    int checkOrderInfo(List<OrdOrderBatch> lstExcelOrderData, List<Map<String, OrdOrderBatchErrorDto>> errorList,String checkType);

    /**
     * 校验批量下单数据详情
     *
     * @param lstExcelOrderData
     * @param errorMapList
     */
    void checkOrderInfoForDetail(List<OrdOrderBatch> lstExcelOrderData, List<Map<String, OrdOrderBatchErrorDto>> errorMapList);

    void saveOrderBatches(List<OrdOrderBatch> orderBatchList);

    void saveOrderBatch(OrdOrderBatch ordOrderBatch);

    /**
     * 批量订单数据查询
     *
     * @param params
     * @return
     */
    QResultDto findSearchDtoByParam(QueryParams params);

    /**
     * 批量订单的详情展示dto
     *
     * @param id
     * @return
     */
    OrdOrderBatchDetailResultDto getDtoById(Integer id);


    List<OrdOrderBatch> findByBatchNumber(String batchNumber);

    /**
     * 修改批量订单的详情
     *
     * @param detailDto
     */
    void updateByDto(OrdOrderBatchDetailDto detailDto);

    OrdOrderBatch getById(Integer id);


    void saveBatchOrder(String batchNumber, OrderStatus orderStatus);


    void updateOrderBatch(OrdOrderBatch ordOrderBatch);

    /**
     * 批量删除某个批次下面的数据
     * @param batchNumber
     * @param ids
     */
    void batchDeleteByIds(String batchNumber,List<Integer> ids);

    void updateDetailCode(OrdOrderBatch ordOrderBatch);

    void updateCargos(OrdOrderBatch ordOrderBatch);

    void updateVerifiedStatus(List<Integer> ids, Boolean status);

    void updateAdditionalTypeCode(OrdOrderBatch ordOrderBatch);

    /**
     * 增加订单附件
     */
    OrdOrderFileDto addOrderFile(Integer orderBatchId, OrdOrderFileDto ordOrderFileDto);

    /**
     * 校验附件的名称
     *
     * @param orderBatchId
     * @param fileName
     * @return
     */
    Boolean checkUniqueName(Integer orderBatchId, String fileName);

    /**
     * 修改附件
     *
     * @param ordOrderBatch
     */
    void updateAttaches(OrdOrderBatch ordOrderBatch);


    void deleteAttatches(Integer orderBatchId,String fileName);

    List<OrdOrderFileDto> getDtos(Integer orderBatchId);

}

